/*
 * @Author: 黄达全
 * @Date: 2024-08-28 16:52:58
 * @LastEditTime: 2024-08-29 17:52:52
 */

import type { ApiResponse } from "@/common/type"

export interface CategoryTreeVO {
    id: number,
        name: string,
        status: number,
        order: number,
        parentId: number,
        icon:string,
        children?: CategoryTreeVO[] | null,
        createTime: string,
        updateTime: string,
        createManagerId: number,
        lastUpdateManagerId: number,
        createManagerName:string,
    lastUpdateManagerName:string,
    hasChildren:boolean,
    imageUrl?:string
}

export type CategoryPageVO ={
    total:number,
    records:CategoryTreeVO[]
}

 export interface CategoryAddForm {
    name: string;
    order: number;
    status: number;
    parentId:number;
    icon:string;
    imageUrl?:string;
}
 export interface CategoryEditForm {
    id:number,
    name: string;
    order: number;
    status: number;
    parentId:number;
    icon:string;
}

export type CategoryApi={
    tree: () => Promise<ApiResponse<CategoryTreeVO[]>>,
    select:(parentId:number,page:number)=>Promise<ApiResponse<CategoryPageVO>>
    add:(form: CategoryAddForm) => Promise<ApiResponse<null>>,
    update:(form: CategoryEditForm) => Promise<ApiResponse<null>>,
    delete:(ids: number[]) => Promise<ApiResponse<null>>,
    // deleteById:(ids: number[]) => Promise<ApiResponse<null>>,
}